package doOperation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class SearchBook implements Operation{
    @Override
    public void work(BookList bookList) {
        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入要查找图书的书名");
        String name = scanner.nextLine();
        for (int i = 0; i < bookList.getUsedSize(); i++) {
            Book book = bookList.getBooks()[i];
            if(book.getName().equals(name)){
                System.out.println("找到了：" + book);
                return;
            }
        }
        System.out.println("没找到");
    }
}
